﻿<Page x:Class="SellAvi.Views.PageAddProduct"
      xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
      xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
      xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
      xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
      xmlns:i="http://schemas.microsoft.com/expression/2010/interactivity"
      mc:Ignorable="d"
      Title="Основные характеристики товара">
    <!--DataContext="{Binding EditProduct, Source={StaticResource Locator}}"-->
    <Grid Margin="4">
        <Grid.Resources>
            <Style TargetType="{x:Type Label}">
                <Setter Property="Padding" Value="0,0,0,0" />
            </Style>
            <Style TargetType="{x:Type TextBox}">
                <Setter Property="Margin" Value="0,1,0,1" />
                <Setter Property="Padding" Value="0,0,0,0" />
            </Style>
            <Style TargetType="{x:Type ComboBox}">
                <Setter Property="Margin" Value="0,1,0,1" />
                <Setter Property="Padding" Value="4,0,4,0" />
            </Style>
        </Grid.Resources>
        <Grid.RowDefinitions>
            <RowDefinition Height="22" />
            <RowDefinition Height="22" />
            <RowDefinition Height="22" />
            <RowDefinition Height="*"/>
            <RowDefinition Height="22" />
            <RowDefinition Height="22" />
            <RowDefinition Height="22" />
        </Grid.RowDefinitions>
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="150" />
            <ColumnDefinition Width="*" />
        </Grid.ColumnDefinitions>

        <!--<TextBox Grid.Row="0" Grid.Column="1" Text="{Binding CurrentAvitoProduct.AvitoUser.CompanyManager}" IsEnabled="False"></TextBox>-->


        <!--
        <Label Grid.Row="2" Grid.Column="0" Content="Телефон"></Label>
        <ComboBox  Grid.Row="2" Grid.Column="1" SelectedIndex="0" ItemsSource="{Binding CurrentAvitoProduct.AvitoUser.SplitedCompanyPhones}"></ComboBox>
         
        <Label Grid.Row="3" Grid.Column="0" Content="Город"></Label>
        <ComboBox  Grid.Row="3" Grid.Column="1" ItemsSource="{Binding ServiceProxy.GetRegions}" DisplayMemberPath="RegionName" SelectedValue="{Binding CurrentAvitoProduct.TRegion_Id}" SelectedValuePath="Id"></ComboBox>

        <Label Grid.Row="4" Grid.Column="0" Content="Метро"></Label>
        <TextBox Grid.Row="4" Grid.Column="1" Text="{Binding CurrentAvitoProduct.Subway}" IsEnabled="False"></TextBox>
        -->

        <Label Grid.Row="0" Grid.Column="0" Content="Владелец объявления"></Label>
        <!--<TextBox Grid.Row="1" Grid.Column="1" Text="{Binding CurrentAvitoProduct.AvitoUser.CompanyName}" IsEnabled="False"></TextBox>-->
        <ComboBox  Grid.Row="0" Grid.Column="1" ItemsSource="{Binding ServiceProxy.GetUsers}" DisplayMemberPath="CompanyName" SelectedValue="{Binding CurrentAvitoProduct.AvitoUser_Id}" SelectedValuePath="Id"></ComboBox>

            <Label Grid.Row="1" Grid.Column="0" Content="Название объявления"></Label>
        <TextBox Grid.Row="1" Grid.Column="1" Text="{Binding CurrentAvitoProduct.Title}"></TextBox>
        
        <Label Grid.Row="2" Grid.Column="0" Content="Цена"></Label>
        <TextBox Grid.Row="2" Grid.Column="1" Text="{Binding CurrentAvitoProduct.Price}"></TextBox>
        
        <StackPanel Grid.Row="3" Grid.Column="0" Margin="0,0,4,0">
            <Image Source="{Binding CurrentAvitoProduct.MainProductImage}" Stretch="UniformToFill" HorizontalAlignment="Center" Margin="0,4,0,0"/>
        </StackPanel>
        <TextBox Grid.Row="3" Grid.Column="1" Text="{Binding CurrentAvitoProduct.Description}" Height="Auto" TextWrapping="Wrap" AcceptsReturn="True"></TextBox>


        
        <UniformGrid Grid.Row="4" Grid.Column="1" Rows="1">
            <Label  Content="Категория"></Label>
            <ComboBox  ItemsSource="{Binding ServiceProxy.GetCategories}" DisplayMemberPath="CategoryName" SelectedValue="{Binding CurrentAvitoProduct.TCategory_Id}" SelectedValuePath="Id" HorizontalAlignment="Right" Width="150">
                <i:Interaction.Triggers>
                    <i:EventTrigger EventName="SelectionChanged">
                        <i:InvokeCommandAction Command="{Binding RefreshFilteredParametersCommand}"/>
                    </i:EventTrigger>
                </i:Interaction.Triggers>
            </ComboBox>
        </UniformGrid>


        <UniformGrid Grid.Row="5" Grid.Column="1" Rows="1">
        <Label Content="Подкатегория"></Label>
        <ComboBox  ItemsSource="{Binding TFilteredParameters}" DisplayMemberPath="ParamName" SelectedValue="{Binding CurrentAvitoProduct.TParam_Id}" SelectedValuePath="Id" HorizontalAlignment="Right" Width="150"></ComboBox>
        </UniformGrid>
        
        <Label Grid.Row="6" Grid.Column="1" Content="{Binding CurrentAvitoProduct.DateInsert}" HorizontalAlignment="Right"></Label>


    </Grid>
</Page>
